package de.global42.clubapp.ejbs;

import java.util.Map;

import javax.ejb.Remote;
import javax.persistence.LockTimeoutException;
import javax.persistence.NoResultException;
import javax.persistence.NonUniqueResultException;
import javax.persistence.PersistenceException;
import javax.persistence.PessimisticLockException;
import javax.persistence.QueryTimeoutException;
import javax.persistence.TransactionRequiredException;

@Remote
public interface EntityAccessor {
	
	
	/**
	 * Returns an object of the requested type, containing the requested name-value-pair
	 * 
	 * @param entityClass : {@link Class} < T > the requested entity type
	 * @param attributeName : {@link String} the name of the entity's attribute
	 * @param attributeValue : {@link String} the value of the attribute
	 * @return < T >
	 * @throws NoResultException
	 * @throws NonUniqueResultException
	 * @throws IllegalStateException
	 * @throws QueryTimeoutException
	 * @throws TransactionRequiredException
	 * @throws PessimisticLockException
	 * @throws LockTimeoutException
	 * @throws PersistenceException
	 */
	public<T> T getEntity(Class<T> entityClass, String attributeName, String attributeValue) 
		throws
			NoResultException,
		    NonUniqueResultException,
		    IllegalStateException,
		    QueryTimeoutException,
		    TransactionRequiredException,
		    PessimisticLockException,
		    LockTimeoutException,
		    PersistenceException,
		    Exception;
	/**
	 * Returns an object of the requested type, containing the requested name-value-pairs
	 * 
	 * @param entityClass : {@link Class} < T > the requested entity type
	 * @param attributeName : {@link String}[] the names of the entity's attribute
	 * @param attributeValue : {@link String}[] the values of the attributes
	 * @return < T >
	 * @throws NoResultException
	 * @throws NonUniqueResultException
	 * @throws IllegalStateException
	 * @throws QueryTimeoutException
	 * @throws TransactionRequiredException
	 * @throws PessimisticLockException
	 * @throws LockTimeoutException
	 * @throws PersistenceException
	 * @throws Exception
	 */
	public<T> T getEntity(Class<T> entityClass, String[] attributeNames, String[] attributeValue) 
			throws
				NoResultException,
			    NonUniqueResultException,
			    IllegalStateException,
			    QueryTimeoutException,
			    TransactionRequiredException,
			    PessimisticLockException,
			    LockTimeoutException,
			    PersistenceException,
			    Exception;
	/**
	 * Returns an object of the requested type, containing the requested name-value-pairs
	 * 
	 * @param entityClass : {@link Class} < T > the requested entity type
	 * @param attributeName : {@link String}[] the names of the entity's attribute
	 * @param attributeValue : {@link String}[] the values of the attributes
	 * @return < T >
	 * @throws NoResultException
	 * @throws NonUniqueResultException
	 * @throws IllegalStateException
	 * @throws QueryTimeoutException
	 * @throws TransactionRequiredException
	 * @throws PessimisticLockException
	 * @throws LockTimeoutException
	 * @throws PersistenceException
	 * @throws Exception
	 */
	public<T> T getEntity(Class<T> entityClass, Map<String, String> nameValuePairs) 
			throws
				NoResultException,
			    NonUniqueResultException,
			    IllegalStateException,
			    QueryTimeoutException,
			    TransactionRequiredException,
			    PessimisticLockException,
			    LockTimeoutException,
			    PersistenceException,
			    Exception;
}
